#ifndef BUTTONREVERSE_H
#define BUTTONREVERSE_H

#include "EventPoller.h"
#include "EventHandler.h"
#include "Text.h"
#include "Sound.h"

#include <D3D10_1.h>
#include <D3DX10.h>
#include <string>

class BReverse : public EventHandler
{
public:
	BReverse();
	~BReverse();

	void Draw();
	void Update();

	void SetPos(const D3DXVECTOR3& pos);
	bool GetOn() const;

	void SetSound(Sound* s);

	virtual void OnMouseMotionEvent(const LPARAM& event) override;
	virtual void OnMouseButtonDownEvent(const MSG& event) override;
	virtual void OnMouseButtonUpEvent(const MSG& event) override;
private:
	void IntersectedMouse();
protected:
	bool m_reversed;
	D3DXVECTOR3 m_pos;
	D3DXVECTOR3 m_size;
	
	D3DXVECTOR2 m_mouseDownPos;
	D3DXVECTOR2 m_convertedMouseDownPos;
	D3DXVECTOR2 m_convertedMousePos;
	D3DXVECTOR2 m_mousePos;
	D3DXVECTOR2 m_screenSize;
	
	float m_outlineSize;

	bool m_mouseMoved;
	bool m_mouseDown;
	bool m_mouseIntersected;
	bool m_mouseButtonWasReleased;
	bool m_mouseDidIntersect;

	Text m_text;
	float m_textSize;
	std::string m_name;

	Sound* m_sound;
};

#endif //BUTTONREVERSE_H